<?php
session_start();
$email=$_SESSION['email'];




include ('header2.php');
 //include('databaseconnection.php');


//$term=$_POST['butt'];
//$acc_mean=$_POST['butt1'];
if(isset ($_GET['li'])){
                $word= $_GET['li'];
            }
$arrr=explode('.',$word);
			$term= $arrr[0];
			$acc_mean=$arrr[1];
			$votes=$arrr[2];
			echo   "<table width='100%' align='left'>";
			echo "<td width='6%' align='right'> <a href='votes.php?err=$term.$acc_mean'>". $votes."</a> <font color='green'>votes</font></td>";
		$resultlike=mysql_query("SELECT * FROM liketable where email='$email' AND term='$term' AND accepted_meaning='$acc_mean' ");
if(!$result) echo "invalid";
if (mysql_num_rows($resultlike) == 1) 
  {
$like='Unlike';
echo "<td width='2%'><font color='green'> and You like this,  </font><a href='like.php?li=$term.$acc_mean.$like'> Unlike</a></td>";
}
else
{
$like='like';
echo "<td width='2%'><input type='image' name='image' src='bullet.gif'/ height='20' width='20'><a href='like.php?li=$term.$acc_mean.$like'> like</a></td>";
}

	
		echo "</table>";
		$result=mysql_query("SELECT * FROM terms WHERE term='$term' and accepted_meaning='$acc_mean'");
		$results=mysql_query("SELECT * FROM domain");
		$resultl=mysql_query("SELECT * FROM language");
echo   "<table width='100%' height='82' border='1' class='table' align='left'>";

while($row=mysql_fetch_array($result))
{
echo "<tr>";
echo "<form action='comment.php' method='POST'>";
echo "<td width='20%'>Term:</td><td width='80%'>".$row['term']."<input type='hidden' name='butt' value='$term'></td></tr>";

echo "<tr><td>Domain:</td><td>".$row['domain']."</td></tr>";

echo "<tr><td>Accepted Meaning:</td><td>".$row['accepted_meaning']."<input type='hidden' name='butt1' value='$acc_mean'></td></tr>";
echo "<tr><td>Language:</td><td>".$row['language']."</td></tr>";
echo "<tr><td>Suggested by:</td><td>".$row['suggested_by']."</td></tr>";
echo "<tr><td>Suggested Date:</td><td>".$row['suggested_date']."</td></tr>";
echo "<tr><td>Checked by:</td><td>".$row['checked_by']."</td></tr>";
echo "<tr><td>Accepted Date:</td><td>".$row['accepted_date']."</td></tr>";
$votes=$row['votes'];
echo "<tr><td>Comments:</td><td>".$row['comments']."</td></tr>";

echo  "<tr><td>Add Comments:</td><td><textarea class='ckeditor' name='message' cols='45' rows='5'></textarea>
<input type='hidden' name='votes' value='$votes'><input type='submit' value='Comment' /></td></tr>";
echo "</tr>";
echo "</form>";
echo "<form action='newsugg.php' method='POST'>";
echo "<tr><td bgcolor='#869FFF' width='30%'>Add Suggestion:</td><td bgcolor='#869FFF'><textarea rows='1' cols='45' name='addsugg'></textarea></td></tr>";

	echo "<tr bgcolor='#869FFF'><td>Select Domain of your Suggestion: </br></br>  <font color='red'>or</font> Add new Domain:</td><td><select name='ndomain' value=''>
					<option value=''>Select domain</option>";
                  while($row=mysql_fetch_array($results))
{
$value=$row['domain'];
echo "<option value='$value'>$value</option>";
}
echo "</select>
				   </br></br> <input type='text' name='newdomain' size='40' value=''></td></tr>";


	echo "<tr bgcolor='#869FFF'><td>Select language of your Suggestion: </br></br> <font color='red'>or</font> Add language:</td><td><select name='nlanguage' value=''>
					<option value=''>Select language</option>";
                  while($row=mysql_fetch_array($resultl))
{
$value=$row['language'];
echo "<option value='$value'>$value</option>";
}
echo "</select>
				   </br></br> <input type='text' name='newlanguage' size='40' value=''>
				   
				 <input type='submit' name='$term' value='Suggest'/></td></tr>";
				   echo "<input type='hidden' name='butt' value='$term'>";
				   echo "<input type='hidden' name='butt1' value='$acc_mean'>";
				  echo " <input type='hidden' name='votes' value='$votes'>";
				   echo "</form>";
				   }
			echo "</table>";	
			
include ('footer.php');
?>
